package com.example.mapper.wechat;

import com.example.pojo.wechat.Order;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @ClassName OrderMapper
 * @Description: com.example.mapper.wechat
 * @Auther: xiwd
 * @Date: 2022/4/19 - 04 - 19 - 0:05
 * @version: 1.0
 */
public interface OrderMapper {
    //methods

    /**
     * 根据openid和status订单状态查询是否存在未完成的订单
     * @param openid
     * @param status
     * @return
     */
    public abstract Order selectOrderByOpenId_Status(@Param(value = "openid")String openid,
                                                     @Param(value = "status")Integer status);


    /**
     * 根据openid查询订单
     * @param openid
     * @return
     */
    public abstract List<Order> selectOrderByOpenId(@Param(value = "openid")String openid);

    /**
     * 根据id查询订单
     * @param id
     * @return
     */
    public abstract Order selectOrderById(@Param(value = "id")Integer id);

    /**
     * 根据订单编号更新订单状态
     * @param id
     * @return
     */
    public abstract Integer updateOrderStatusById(@Param(value = "id")Integer id,
                                                  @Param(value = "status")Integer status);

    /**
     * 创建新的订单
     * @param openid
     * @param markerId
     * @return
     */
    public abstract Integer addOrder(@Param(value = "openid")String openid,
                                     @Param(value = "markerid")Integer markerId);


}
